/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Filter;

import java.util.Date;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 *
 * @author Alvaro
 */
public class ListenerDeSesion implements HttpSessionListener{
    public void sessionCreated(HttpSessionEvent s)
    {
        HttpSession session = s.getSession();
        System.out.println("A las " + getTime() +" se creo la sesion: "+session.getId() +" con "+session.getMaxInactiveInterval());
        
    }
    
    public void sessionDestroyed(HttpSessionEvent s)
    {
        HttpSession session = s.getSession();
        System.out.println("A las " + getTime() +" se destruyo la sesion: "+session.getId());
        
    }
    
    private String getTime()
    {
        return new Date(System.currentTimeMillis()).toString();
    }
}
